﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class FM_AudioSubTrack : IComparable<FM_AudioSubTrack>
{
    public int track { get; set; }
    public int duration { get; set; }

    public FM_AudioSubTrack(int track, int duration)
    {
        this.track = track;
        this.duration = duration;
    }

    public override bool Equals(object obj)
    {
        if (this == obj)
            return true;
        if (obj == null || GetType() != obj.GetType())
            return false;

        FM_AudioSubTrack other = (FM_AudioSubTrack)obj;
        return duration == other.duration && track == other.track;
    }

    public override int GetHashCode()
    {
        return CombineHashCodes(track, duration);
    }

    public int CompareTo(FM_AudioSubTrack other)
    {
        if (track > other.track || track == other.track)
            return 1;
        return -1;
    }

    public int CombineHashCodes(params object[] objects)
    {
        unchecked
        {
            int hash = 17; // 初始哈希码
            foreach (var obj in objects)
            {
                hash = hash * 23 + (obj != null ? obj.GetHashCode() : 0);
            }
            return hash;
        }
    }
}
